﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TPCN.Controls
{
    public partial class uc_searchbox : System.Web.UI.UserControl
    {
        private const string DEFAULT_NULL_TEXT = "Tìm kiếm...";

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string query = String.Empty;
            query = txtSearch.Text;
            if (query != DEFAULT_NULL_TEXT)
            {
                Response.Redirect("~/Default.aspx?q=" + query);
            }
        }

        protected void btnSubmit_Init(object sender, EventArgs e)
        {
            btnSubmit.OnClientClick = "return !checkEmptyQuery(" + txtSearch.ClientID + ")";
        }
    }
}